Skip to content

Store flags as images - #156

Open
j4d35t0n3 wants to merge 32 commits into
hykilpikonna:masterfrom
j4d35t0n3:master
Open

Store flags as images#156
j4d35t0n3 wants to merge 32 commits into
hykilpikonna:masterfrom
j4d35t0n3:master

Conversation

@j4d35t0n3

Copy link
Copy Markdown

Description

The current system for storing flags only stores striped patterns. This pull request changes it to storing flags as images, allowing for non-stripe patterns and custom flags.

Relevant Links

This adds the demisexual flag #30 and allows for custom flags to be added #46.

Screenshots

Screenshot_1
Screenshot_2
Screenshot_3

Additional context

Future versions could add a command line utility for managing custom flags.

@hykilpikonna

Copy link
Copy Markdown
Owner

Thank you so much for the refactoring to make image-based flag rendering possible! This is a very significant update, and I'd like to ensure that I thoroughly understand everything before integrating. I appreciate your patience as we work toward incorporating these changes for the next release.

Comment thread hyfetch/termenv.py Outdated
Comment on lines +88 to +91
tty = importlib.import_module("tty")
signal = importlib.import_module("signal")
termios = importlib.import_module("termios")
select = importlib.import_module("select").select

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can actually achieve the same effect by just moving the import statements inside the function. Dynamic importing using importlib is only required if the module name is a string that you don't know beforehand.

Comment thread hyfetch/__init__.py Outdated
Comment on lines -1 to -2
from __future__ import annotations

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please don't remove from __future__ import annotations, they're required for Python 3.7-8 compatibility. Thanks!

@j4d35t0n3

Copy link
Copy Markdown
Author

Just added the fixes!

Comment thread hyfetch/flag_utils.py Outdated
Comment on lines +52 to +55
files = os.listdir('hyfetch/flags')
# Remove file extensions
files_no_ext = [f.split('.')[0] for f in os.listdir('hyfetch/flags')]
# Get index of file in list of files without extensions, raise error if it doesn't exist

@hykilpikonna hykilpikonna Aug 17, 2023

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using relative directories like this actually wouldn't work when you're outside the hyfetch directory. For example, if you use pip install . to install hyfetch and run hyfetch -c outside of the hyfetch directory, it would raise a FileNotFound error. You should use paths relative to the current file instead. (e.g. Path(__file__).parent / 'flags')

image

Comment thread hyfetch/helper_types.py Outdated
Comment on lines +1 to +7
from __future__ import annotations

from typing_extensions import Literal

AnsiMode = Literal['default', 'ansi', '8bit', 'rgb']
LightDark = Literal['light', 'dark']
BackendLiteral = Literal["neofetch", "fastfetch"]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already hyfetch/types.py.

@j4d35t0n3

Copy link
Copy Markdown
Author

Updated!

@j4d35t0n3

Copy link
Copy Markdown
Author

Applied merges!

@j4d35t0n3 j4d35t0n3 reopened this Sep 14, 2023
@pulustelu

Copy link
Copy Markdown

Is this still active?

@fyrna

fyrna commented Jun 23, 2025

Copy link
Copy Markdown

Is this still active?

Looks like no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants